<?php
declare(strict_types=1);

namespace App\Services;

use App\Interface\PaymentStrategyInterface;
use App\Interface\Pay\WeChatPaymentStrategy;
use App\Interface\Pay\AliPaymentStrategy;
use Hyperf\HttpServer\Contract\RequestInterface;
use InvalidArgumentException;

class PaymentStrategyFactory
{
    public static function createPaymentStrategy(string $paymentMethod, RequestInterface $request): PaymentStrategyInterface
    {
        return match ($paymentMethod) {
            'wechat' => new WeChatPaymentStrategy($request),
            'alipay' => new AliPaymentStrategy($request),
             default => throw new InvalidArgumentException('Unsupported payment method'),
        };
    }
}
